<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20101227;15072500">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.27in 11.69in }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P><BR><BR>
</P>
<P STYLE="text-decoration: none"><FONT SIZE=6 STYLE="font-size: 22pt"><B>Unconstrained
optimization</B></FONT></P>
<P STYLE="text-decoration: none"><FONT SIZE=6 STYLE="font-size: 22pt"><B>One
variable – No derivative</B></FONT></P>
<P STYLE="text-decoration: none"><FONT SIZE=6 STYLE="font-size: 22pt"><B>minin</B></FONT></P>
<P>Determines a point x \in [a, b] at which the real valued function
f(x) assumes a minimum value.</P>
<P><BR><BR>
</P>
<P><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E
to open the editor)</B></P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">import
java.text.DecimalFormat;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">import numal.*;</FONT></P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">public class Test_minin
extends Object</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">implements AP_minin_methods {</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">public static void
main(String args[]) {</FONT></P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double m;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double x[] = new double[1];</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double a[] = new double[1];</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double b[] = new double[1];</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double tmp1[] = {1.0};</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double tmp2[] = {4.0};</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">Test_minin testminin = new
Test_minin();</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">DecimalFormat fiveDigit = new
DecimalFormat(&quot;0.00000E0&quot;);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">a[0]=1.0+testminin.tolx(tmp1);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">b[0]=4.0-testminin.tolx(tmp2);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">m=Analytic_problems.minin(x,a,b,testminin);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">System.out.println(&quot;Minimum
is &quot; + fiveDigit.format(m) +</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">&quot;\nFor x is &quot; +
fiveDigit.format(x[0]) +</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">&quot;\nin the interval with
endpoints &quot; +</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">fiveDigit.format(a[0]) + &quot;
&quot; + fiveDigit.format(b[0]));</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">}</FONT></P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">public double fx(double x[])</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">{</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">int i;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">double s,temp;</FONT></P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">s=0.0;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">for (i=1; i&lt;=20; i++) {</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">temp=(i*2-5)/(x[0]-i*i);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">s += temp*temp;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">}</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">return s;</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">}</FONT></P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">public double tolx(double
x[])</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">{</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">return
(Math.abs(x[0])*1.0e-6+1.0e-6);</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">}</FONT></P>
<P><FONT SIZE=2 STYLE="font-size: 11pt">}</FONT></P>
</BODY>
</HTML>